<?php
ob_start();
session_start();
if(!isset($_SESSION['user'])){
	echo  "请你先登陆<a href=\"/index.php\">login</a>";
	exit();
}

require('../config.php');
require('page.class.php');
mysql_select_db(SAE_MYSQL_DB,$conn) or die("数据库".SAE_MYSQL_DB."连接失败!");
$yeah=$_GET['y'];
$month=$_GET['m'];
$list=array();
if($yeah && $month){
$sum="SELECT sum(spmoney) as 'littleSum' , `spopt` as 'mysum'  FROM sp WHERE  month(sptime)=".$month." and year(sptime)=".$yeah." group by `spopt`";

//echo $sum;
$rs=mysql_query($sum,$conn);
while($obj=mysql_fetch_object($rs))
{
	$list[]=$obj;
}
}else{
  $list="{'littleSum':'0','mysum':0}";
}
echo '{"results":'.json_encode($list).'}';

?>

